/*-------------------------------------
		sPlugin
	    By Scooby, 2010
-------------------------------------*/

local PLUGIN = {}

PLUGIN.Name = "UberSlap"
PLUGIN.Author = "Scooby"
PLUGIN.Command = "uberslap"
PLUGIN.Group = 2
PLUGIN.Category = "Punishment"
PLUGIN.Format = "string"
PLUGIN.Use = "<Player>"
PLUGIN.Menu = {
	{
		title = "Choose Player",
		cont = "#players",
		apos = 1
	}
}

function PLUGIN:Main( ply, args )
	
	local pl = spl:FindPly( args[1] )
	local vol = 500
	local sound = "physics/body/body_medium_break"..math.random( 1, 4 )..".wav"
	local ent = ents.Create( "env_explosion" )
	
	if( #pl == 0 ) then
		spl:PrintC( ply, spl.red, spl.fnp )
		return false
	elseif( #pl > 1 ) then
		spl:PrintC( ply, spl.red, spl.fmp )
		return false
	end
	
	spl.DenyClip( pl[1] )
	pl[1]:SetMoveType( MOVETYPE_WALK )
	pl[1]:EmitSound( sound, vol )
	pl[1]:SetVelocity( pl[1]:GetRight() + Vector( 500, -300, 250 ) * 1000 )
	pl[1]:ViewPunch( Angle( -400, -300, 0 ) )
	timer.Simple( 2, function()
		ent:SetPos( pl[1]:GetPos() + Vector( 0, 0, 20 ) )
		ent:SetKeyValue( "iMagnitude","175" )
		ent:Fire("Explode", 0, 0 )
		pl[1]:Kill()
		spl.AllowClip( pl[1] )
	end)
	
	spl:PrintC( spl.red, pl[1]:Nick(), spl.white, " Was UberSlapped By ", spl.blue, ply:Nick() )
		
end


spl:AddPlugin( PLUGIN )